package client;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Timer;

public class ActionButtonsLis implements ActionListener {
	StartClient client;
	Timer timer;
	
	public ActionButtonsLis(StartClient sc) {
		client = sc;
		timer = new Timer();
	}
	
	
	public void actionPerformed(ActionEvent action) {
		int actionNumber = Integer.parseInt(action.getActionCommand());
		
		switch(actionNumber) {
		case 1:
			StartClient.chatOutput.append("\nYou attack x ["+client.player.actions[0]+"]");
			client.btnAtt.setBackground(Color.RED);
			//Auto use when ctrl hold
			if(action.getModifiers() == 18) {
				System.out.println("Auto not supported atm.");
			}
			timer.schedule(new ActionButtonTask(client.btnAtt), client.player.actions[0]);
			client.btnAtt.setMultiClickThreshhold(client.player.actions[0]); //net<gut
			break;
		case 2:
			StartClient.chatOutput.append("\nYou use 'special' ["+client.player.actions[1]+"]");
			client.btnSpecial.setBackground(Color.RED);
			timer.schedule(new ActionButtonTask(client.btnSpecial), client.player.actions[1]);
			client.btnSpecial.setMultiClickThreshhold(client.player.actions[1]);
			break;
		}
	}

}
